package com.szy;

import android.app.ActivityGroup;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
//ss
public class ActivityGroupDemoActivity extends ActivityGroup {
    /** Called when the activity is first created. */
	private Button button;
	private LinearLayout layout;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        findView();
        listener();
    }
    private void findView(){
    	button=(Button) findViewById(R.id.groupButton);
    	layout=(LinearLayout) findViewById(R.id.linearLayout1);
    }
    private void listener(){
    	button.setOnClickListener(new ButtonListener());
    }
    class ButtonListener implements OnClickListener{

		@Override
		public void onClick(View arg0) {
			// TODO Auto-generated method stub
			Intent intent = new Intent(ActivityGroupDemoActivity.this,GroupViewActivity.class);
			intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
			View view = getLocalActivityManager().startActivity("btn", intent).getDecorView();
			layout.addView(view);
		}
    	
    }
}